package cn.source.web.controller.zk;


import cn.source.common.core.controller.BaseController;
import cn.source.common.core.domain.AjaxResult;
import cn.source.zk.domain.entity.DeviceDetails;
import cn.source.zk.service.IZkDeviceDetailService;
import cn.source.zk.service.IZkDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/zk/deviceDetails")
public class ZkDeviceDetailsController extends BaseController {

    @Autowired
    private IZkDeviceDetailService deviceDetailService;

    /**
     * 根据num查询设备明细
     * @param num
     * @return
     */
    @GetMapping("/{num}")
    public AjaxResult getByNum(@PathVariable Long num){
        DeviceDetails deviceDetails = deviceDetailService.getByDevId(num);

        return AjaxResult.success(deviceDetails);
    }

    @PutMapping()
    public AjaxResult edit(@RequestBody DeviceDetails deviceDetails){

        return toAjax(deviceDetailService.edit(deviceDetails));
    }

}
